package com.wlyuan.open.scanner.application.handler.full;

import com.wlyuan.open.dto.OpenCarrierSyncDTO;
import com.wlyuan.open.scanner.application.annotation.ScannerCode;
import com.wlyuan.open.scanner.assembler.ScannerCarrierAssembler;
import com.wlyuan.open.scanner.constant.ScannerCodeEnum;
import com.wlyuan.open.scanner.domain.carrier.Carrier;
import com.wlyuan.open.scanner.repository.CarrierRepository;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author lijing
 * @description
 */
@ScannerCode(code = ScannerCodeEnum.CARRIER)
@Service
@Slf4j
@RequiredArgsConstructor
public class ScannerCarrierHandler extends BaseScannerHandler<Carrier, OpenCarrierSyncDTO> {
    private final CarrierRepository carrierRepository;

    @Override
    protected List<Carrier> select() {
        return carrierRepository.getList();
    }

    @Override
    protected List<OpenCarrierSyncDTO> assembler(List<Carrier> data) {
        return ScannerCarrierAssembler.assemble(data);
    }
}
